package cn.heycm.blog.console.infra.convert;

import cn.heycm.blog.api.console.article.vo.AdminArticleVO;
import cn.heycm.blog.api.console.article.vo.ArticleHistoryVO;
import cn.heycm.blog.console.infra.dao.article.entity.Article;
import cn.heycm.blog.console.infra.dao.article.entity.ArticleHistory;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * 文章转换
 *
 * @author hey
 * @version 1.0
 * @since 2024/9/26 17:51
 */
@Mapper
public interface ArticleConverter {

    ArticleConverter INST = Mappers.getMapper(ArticleConverter.class);

    AdminArticleVO toVO(Article article);

    @Mapping(target = "createTime", ignore = true)
    ArticleHistory toHistory(Article article);

    ArticleHistoryVO toVO(ArticleHistory history);
}
